import React from 'react';
import { Card, Descriptions, Tag, List, Divider } from 'antd';

const PatientDetail = ({ patient }) => {
  return (
    <div className="patient-detail">
      <Card title="基本信息" style={{ marginBottom: 16 }}>
        <Descriptions column={2}>
          <Descriptions.Item label="姓名">{patient.name}</Descriptions.Item>
          <Descriptions.Item label="性别">{patient.gender}</Descriptions.Item>
          <Descriptions.Item label="年龄">{patient.age}</Descriptions.Item>
          <Descriptions.Item label="联系方式">{patient.phone}</Descriptions.Item>
          <Descriptions.Item label="入院号">{patient.admissionNumber}</Descriptions.Item>
          <Descriptions.Item label="入院日期">{patient.date}</Descriptions.Item>
        </Descriptions>
      </Card>

      <Card title="病史信息" style={{ marginBottom: 16 }}>
        <Descriptions column={1}>
          <Descriptions.Item label="主诉">
            {patient.diagnosis.main} ({patient.diagnosis.severity})
          </Descriptions.Item>
          <Descriptions.Item label="既往病史">{patient.medicalHistory}</Descriptions.Item>
          <Descriptions.Item label="过敏史">{patient.allergyHistory || '无'}</Descriptions.Item>
        </Descriptions>
      </Card>

      <Card title="检查记录" style={{ marginBottom: 16 }}>
        <List
          dataSource={patient.examination}
          renderItem={(item) => (
            <List.Item>
              <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}>
                <span>{item.name}</span>
                <Tag color="blue">{item.result}</Tag>
              </div>
            </List.Item>
          )}
        />
      </Card>

      <Card title="治疗方案" style={{ marginBottom: 16 }}>
        <List
          dataSource={patient.treatment}
          renderItem={(item) => (
            <List.Item>
              <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}>
                <span>{item.name}</span>
                <span>{item.plan}</span>
              </div>
            </List.Item>
          )}
        />
      </Card>

      <Card title="出院建议">
        <div style={{ padding: 16 }}>
          {patient.dischargeAdvice}
        </div>
      </Card>

      <Divider orientation="left">诊断结果</Divider>
      <Descriptions bordered>
        <Descriptions.Item label="主要诊断">
          <Tag color="red">{patient.diagnosis.main}</Tag>
        </Descriptions.Item>
        <Descriptions.Item label="严重程度">
          {patient.diagnosis.severity}
        </Descriptions.Item>
        <Descriptions.Item label="次要诊断">
          {patient.diagnosis.secondary}
        </Descriptions.Item>
        <Descriptions.Item label="临床表现">
          {patient.diagnosis.description}
        </Descriptions.Item>
      </Descriptions>
    </div>
  );
};

export default PatientDetail;